package org.example.controller.impl;

import org.example.api.UserController;
import org.example.api.vo.UserInfoVo;
import org.example.common.dto.UserInfoDto;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/user")
public class UserControllerImpl implements UserController {

    @Autowired
    UserService userService;

    @Override
    @GetMapping("/getUserById")
    public UserInfoVo getUserById(Integer id) {
        UserInfoDto userById = userService.getUserById(id);
        UserInfoVo vo = new UserInfoVo();
        vo.setUsername(userById.getUsername());
        vo.setRealName(userById.getRealName());
        return vo;
    }
}

